package cn.bughub.controller;

import cn.bughub.model.vo.datasource.AddDataSourceRequestVo;
import cn.bughub.service.DataSourceService;
import cn.bughub.util.ResultResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 数据源控制器
 *
 * @author zwj
 * @date 2024-09-25
 */
@RestController
@RequestMapping("/data-sources")
@RequiredArgsConstructor
public class DataSourceController {
    
    private final DataSourceService dataSourceService;
    
    /**
     * 添加数据源
     *
     * @param addDataSourceRequestVo 加数据源请求实体类
     * @return {@link ResultResponse }<{@link Long }>
     */
    @PostMapping("")
    public ResultResponse<Long> addDataSource(AddDataSourceRequestVo addDataSourceRequestVo) {
        
        return ResultResponse.success(dataSourceService.addDataSource(addDataSourceRequestVo));
    }
}

